﻿/*
 * Created by SharpDevelop.
 * User: Andrew Sadler
 * Date: 06/09/2012
 * Time: 21:27
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;

namespace RRRSRoguelike.Helpers
{
	/// <summary>
	/// Description of ConsoleSpecific.
	/// </summary>
	public class ConsoleSpecific
	{	
			public static void SetUpConsole(string title)
    	    {
    	        //Added console height and width to constants.  Resizes on draw if user changes.
        	    SetConsoleSize(Constants.ConsoleWidth, Constants.ConsoleHeight);
        	           
   		        //Prints the name and version number at the top of the window.
   		        Console.Title = title;
   		        Console.CursorVisible = false;
   		    }
			
			public static void SetConsoleSize(int width, int height) 
        	{
            	//getting bigger
            	if (width >= Console.WindowWidth && height >= Console.WindowHeight)
            	{ 
                	Console.SetBufferSize(width, height);
                	Console.SetWindowSize(width, height);
            	}	
            	//getting smaller
            	else if (width <= Console.WindowWidth && height <= Console.WindowHeight)
	            {
    	            Console.SetWindowSize(width, height);
    	            Console.SetBufferSize(width, height);
    	        } 
    	        //width bigger height smaller
    	        else if (width >= Console.WindowWidth && height <= Console.WindowHeight)
    	        {
    	            Console.SetWindowSize(Console.WindowWidth, height);
    	            Console.SetBufferSize(width, height);
    	            Console.SetWindowSize(width, height);
    	        }
    	        //width smaller height bigger
    	        else if (width <= Console.WindowWidth && height >= Console.WindowHeight)
    	        {
    	            Console.SetWindowSize(width, Console.WindowHeight);
    	            Console.SetBufferSize(width, height);
    	            Console.SetWindowSize(width, height);
    	        }
	    	}
			
		
		public static void ReadKey(bool intercept)
		{
			Console.ReadKey(intercept);
		}
		
		public static void Clear()
		{
			Console.Clear();
		}
		
		}
	}
